import request from '@/utils/request'

export function loginByThirdparty(username, password, imagecode) {
  const data = {
    username,
    password,
    imagecode
  }
  return request({
    url: '/api/auth/authorization/token',
    method: 'post',
    data
  })
}

export function loginByEmail(username, password, imagecode) {
  const data = {
    username,
    password,
    imagecode
  }
  return request({
    url: '/api/admin/auth/token?grant_type=password',
    method: 'post',
    data
  })
}

export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  return request({
    url: '/login/login',
    method: 'post',
    data
  })
}

export function sendCodeByLoginPhone(phone) {
  const data = {
    phone
  }
  return request({
    url: '/api/auth/authorization/sendCodeByPhone',
    method: 'post',
    data
  })
}
export function loginByPhone(phone, code) {
  const data = {
    phone,
    code
  }
  return request({
    url: '/api/auth/authorization/loginByPhone',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/api/admin/auth/logout',
    method: 'get'
  })
}

export function getInfo() {
  return request({
    url: '/api/admin/user/front/info',
    method: 'get'
  })
}

export function getMenus() {
  return request({
    url: '/api/admin/user/menus',
    method: 'get'
  })
}

export function getAllMenus() {
  return request({
    url: '/api/admin/menu/all',
    method: 'get'
  })
}

